/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ordering.pojo;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author sulan
 */
@Entity
@Table(name = "t_order_head")
@NamedQueries({@NamedQuery(name = "TOrderHead.findAll", query = "SELECT t FROM TOrderHead t"), @NamedQuery(name = "TOrderHead.findById", query = "SELECT t FROM TOrderHead t WHERE t.id = :id"), @NamedQuery(name = "TOrderHead.findByOrderNo", query = "SELECT t FROM TOrderHead t WHERE t.orderNo = :orderNo"), @NamedQuery(name = "TOrderHead.findByOrderType", query = "SELECT t FROM TOrderHead t WHERE t.orderType = :orderType"), @NamedQuery(name = "TOrderHead.findByOrderStatus", query = "SELECT t FROM TOrderHead t WHERE t.orderStatus = :orderStatus"), @NamedQuery(name = "TOrderHead.findByCardNum", query = "SELECT t FROM TOrderHead t WHERE t.cardNum = :cardNum"), @NamedQuery(name = "TOrderHead.findByTableNo", query = "SELECT t FROM TOrderHead t WHERE t.tableNo = :tableNo"), @NamedQuery(name = "TOrderHead.findByPhone", query = "SELECT t FROM TOrderHead t WHERE t.phone = :phone"), @NamedQuery(name = "TOrderHead.findByAddress", query = "SELECT t FROM TOrderHead t WHERE t.address = :address"), @NamedQuery(name = "TOrderHead.findByActualPrice", query = "SELECT t FROM TOrderHead t WHERE t.actualPrice = :actualPrice"), @NamedQuery(name = "TOrderHead.findByCreatUser", query = "SELECT t FROM TOrderHead t WHERE t.creatUser = :creatUser"), @NamedQuery(name = "TOrderHead.findByCreateDate", query = "SELECT t FROM TOrderHead t WHERE t.createDate = :createDate"), @NamedQuery(name = "TOrderHead.findByUpdateUser", query = "SELECT t FROM TOrderHead t WHERE t.updateUser = :updateUser"), @NamedQuery(name = "TOrderHead.findByUpdateDate", query = "SELECT t FROM TOrderHead t WHERE t.updateDate = :updateDate")})
public class TOrderHead implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Column(name = "order_no")
    private String orderNo;
    @Column(name = "order_type")
    private String orderType;
    @Column(name = "order_status")
    private String orderStatus;
    @Column(name = "card_num")
    private String cardNum;
    @Column(name = "table_no")
    private String tableNo;
    @Column(name = "phone")
    private String phone;
    @Column(name = "address")
    private String address;
    @Column(name = "actual_price")
    private Float actualPrice;
    @Column(name = "creat_user")
    private String creatUser;
    @Column(name = "create_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Column(name = "update_user")
    private String updateUser;
    @Column(name = "update_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateDate;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "orderHeadId")
    private Collection<TOrderDetail> tOrderDetailCollection;

    public TOrderHead() {
    }

    public TOrderHead(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        Long oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        String oldOrderNo = this.orderNo;
        this.orderNo = orderNo;
        changeSupport.firePropertyChange("orderNo", oldOrderNo, orderNo);
    }

    public String getOrderType() {
        return orderType;
    }

    public void setOrderType(String orderType) {
        String oldOrderType = this.orderType;
        this.orderType = orderType;
        changeSupport.firePropertyChange("orderType", oldOrderType, orderType);
    }

    public String getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        String oldOrderStatus = this.orderStatus;
        this.orderStatus = orderStatus;
        changeSupport.firePropertyChange("orderStatus", oldOrderStatus, orderStatus);
    }

    public String getCardNum() {
        return cardNum;
    }

    public void setCardNum(String cardNum) {
        String oldCardNum = this.cardNum;
        this.cardNum = cardNum;
        changeSupport.firePropertyChange("cardNum", oldCardNum, cardNum);
    }

    public String getTableNo() {
        return tableNo;
    }

    public void setTableNo(String tableNo) {
        String oldTableNo = this.tableNo;
        this.tableNo = tableNo;
        changeSupport.firePropertyChange("tableNo", oldTableNo, tableNo);
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        String oldPhone = this.phone;
        this.phone = phone;
        changeSupport.firePropertyChange("phone", oldPhone, phone);
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        String oldAddress = this.address;
        this.address = address;
        changeSupport.firePropertyChange("address", oldAddress, address);
    }

    public Float getActualPrice() {
        return actualPrice;
    }

    public void setActualPrice(Float actualPrice) {
        Float oldActualPrice = this.actualPrice;
        this.actualPrice = actualPrice;
        changeSupport.firePropertyChange("actualPrice", oldActualPrice, actualPrice);
    }

    public String getCreatUser() {
        return creatUser;
    }

    public void setCreatUser(String creatUser) {
        String oldCreatUser = this.creatUser;
        this.creatUser = creatUser;
        changeSupport.firePropertyChange("creatUser", oldCreatUser, creatUser);
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        Date oldCreateDate = this.createDate;
        this.createDate = createDate;
        changeSupport.firePropertyChange("createDate", oldCreateDate, createDate);
    }

    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        String oldUpdateUser = this.updateUser;
        this.updateUser = updateUser;
        changeSupport.firePropertyChange("updateUser", oldUpdateUser, updateUser);
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        Date oldUpdateDate = this.updateDate;
        this.updateDate = updateDate;
        changeSupport.firePropertyChange("updateDate", oldUpdateDate, updateDate);
    }

    public Collection<TOrderDetail> getTOrderDetailCollection() {
        return tOrderDetailCollection;
    }

    public void setTOrderDetailCollection(Collection<TOrderDetail> tOrderDetailCollection) {
        this.tOrderDetailCollection = tOrderDetailCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TOrderHead)) {
            return false;
        }
        TOrderHead other = (TOrderHead) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ordering.pojo.TOrderHead[id=" + id + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
